/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import { isArray } from 'lodash';

export async function getKbdbyList(params: any): Promise<any> {
  return request('/LogisticsPortSurvey/getSurveyData', {
    method: 'POST',
    data: params,
  }).then(({ data }) => {
    const { list, page, count: total } = data || {};
    if (isArray(list) && list.length > 0) {
      return {
        total,
        success: true,
        data: list,
        page,
      };
    }
    return {};
  });
}

export async function exExcel() {
  return request('/LogisticsPortSurvey/surveyDataDerive', {
    method: 'GET',
  }).then((res) => {
    if (res.code == 0) {
      window.location.href = res.data;
    }
  });
}
